export function getDate(fieldType, formItems) {
    let formAll = JSON.parse(JSON.stringify(formItems))
    let data = formAll.find(item => {
        return item.fieldType === fieldType;
    });
    return data;
}
export function resetData(data, element) {
    const privateInfo = element.privateInfo
        ? JSON.parse(element.privateInfo)
        : {};
    const user = privateInfo.user
        ? JSON.parse(privateInfo.user)
        : {};
    // data.label = element.fieldName;
    // data.placeholder = element.description;
    // data.required = element.isMandatory;
    data.id = element.fieldId.toString();
    data._id = element.fieldId.toString();
    data.size = Number(data.size);
    data.bold = data.bold ? Number(data.bold) : 400;
    data.layout = 'colItem'
    data.fieldId = element.fieldId;
    const ele = { ...element, ...privateInfo, ...user }
    ele.label = element.fieldName;
    let newData = Object.assign(data, ele);
    if (element.fieldType === "RadioBox" || element.fieldType === "SelectRadio" || element.fieldType === "Checkbox" || element.fieldType === "SelectCheck") {
        if (privateInfo.dictTblId) {
            newData.options = [{ "value": privateInfo.dictTblId, "label": privateInfo.dictTblName }];
            newData.dataType = 'dynamic'
        }
    }
    if (privateInfo) {
        newData.maxLength = privateInfo.dataLen;
    }
    return newData;
}